<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of SaveToFile
 *
 * @author Implement <hdjahs@qq.com>
 */
class SaveToFile {

    private $obj;

    public function __construct($obj) {
        $this->obj = $obj;
    }

    public function save() {
        $filePath = $this->obj->txtPath . $this->obj->key . '.txt';
        if ($this->obj->str && !file_exists($filePath)) {
            file_put_contents($filePath, $this->obj->str);
            $filePath = $this->obj->tmpPath . md5($filePath) . '.txt';
            file_put_contents($filePath, 1);
        }
    }

}
